package cn.cloud9.opencloud.common.spring.controller;

import cn.cloud9.opencloud.common.annotation.LoginCheckPassed;
import cn.cloud9.opencloud.common.api.Result;
import cn.cloud9.opencloud.common.api.ResultMessage;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author OnCloud9
 * @description
 * @project Open-Cloud
 * @date 2022年04月16日 15:11
 */
@RestController
@RequestMapping("${sys.path}/${error.page.path}")
public class ErrorController extends BaseController {

    @GetMapping("/404")
    @LoginCheckPassed
    public Result<Object> _404() {
        return Result.getInstance().error(ResultMessage.API_NOT_FOUND);
    }

    @GetMapping("/404")
    @LoginCheckPassed
    public Result<Object> _405() {
        return Result.getInstance().error(ResultMessage.METHOD_NOT_ALLOWED);
    }

    @GetMapping("/500")
    @LoginCheckPassed
    public Result<Object> _500() {
        return Result.getInstance().error(ResultMessage.SYSTEM_ERROR);
    }

}
